// 数据来源管理接口
import { ajaxService } from '@/utils/request';
import * as ctl from './type';

const env = import.meta.env;
const baseURL = env.VITE_BASE_URL;
/**
 *
 * @param data 添加数据来源
 * @returns
 */
export async function AddDataResources(data: ctl.DataResources) {
  return ajaxService({
    url: '/platform_ccc/dr/data/resources',
    method: 'post',
    baseURL,
    data
  });
}
/**
 * 获取数据来源列表
 * @param params
 * @returns
 */
export async function getDataResourcesList(params: ctl.DataResourcesParams) {
  return ajaxService<{ content: any }>({
    url: '/platform_ccc/dr/data/resources/page',
    method: 'get',
    baseURL,
    params
  });
}
export async function getDataResourcesById(id: number) {
  return ajaxService<any>({
    url: `/platform_ccc/dr/data/resources/${id}`,
    method: 'get',
    baseURL
  });
}
/**
 * 编辑数据来源
 * @param params
 * @returns
 */
export async function editDataResources(data: ctl.DataResources) {
  return ajaxService({
    url: '/platform_ccc/dr/data/resources',
    method: 'put',
    baseURL,
    data
  });
}
/**
 * 删除数据来源
 * @param params
 * @returns
 */
export async function delDataResourcesByIds(data: { ids: number[] }) {
  return ajaxService({
    url: `/platform_ccc/dr/data/resources`,
    method: 'delete',
    baseURL,
    data
  });
}
